# 并发
import socket


phone = socket.socket(socket.AF_INET, socket.SOCK_STREAM)


phone.connect(('127.0.0.1', 8080))
while True:
    # 发送消息
    msg = input('输入》》》:').strip()
    if len(msg) == 0:
        continue
    phone.send(msg.encode('utf-8'))
    # 接收消息
    data = phone.recv(1024)
    print("服务端回复:", data.decode('utf-8'))
    print("服务端回复:", len(data))

# 挂电话
phone.close()

